package cn.tedu.springboot.pojo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.Date;

@Component
@ConfigurationProperties(prefix = "person")
//第一步  将类的对象创建交给了ioc来处理
public class Person {
    //@Value("yanpengyu") 第一种方式可以给具体属性赋值
    @Value("${user.username}")//第二种方式就是模拟了一下 以前用配置文件来完成的任务方式
    private String name;
    //@Value("18")第一种方式可以给具体属性赋值
    @Value("${user.age}")//第二种方式就是模拟了一下 以前用配置文件来完成的任务方式
    private Integer age;
    //@Value("${person.salary}")
    private Integer salary;
    //@Value("${person.like}")
    private String[] like;
    //@Value("${person.birth}")
    private Date birth;

    public Integer getSalary() {
        return salary;
    }

    public void setSalary(Integer salary) {
        this.salary = salary;
    }

    public String[] getLike() {
        return like;
    }

    public void setLike(String[] like) {
        this.like = like;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", salary=" + salary +
                ", like=" + Arrays.toString(like) +
                ", birth=" + birth +
                '}';
    }
}
